package com.zzy.mccjt.exception;

/**
 * @program: mccjt-cloud
 * @description: 业务异常
 * @author: zhouyang.zheng
 * @create: 2022-08-02 17:45
 **/
public class BusinessException extends BaseException {

    public BusinessException(IErrorInfo errorInfo) {
        super(errorInfo.getCode(), errorInfo.getMessage());
    }

    public BusinessException(IErrorInfo errorInfo, Throwable cause) {
        super(errorInfo.getCode(), errorInfo.getMessage(), cause);
    }

    public BusinessException(IErrorInfo errorInfo, Object... args) {
        super(errorInfo.getCode(), errorInfo.getMessage(), args);
    }

    public BusinessException(IErrorInfo errorInfo, Throwable cause, Object... args) {
        super(errorInfo.getCode(), cause, errorInfo.getMessage(), args);
    }

    public static BusinessException of(IErrorInfo errorInfo) {
        return new BusinessException(errorInfo);
    }

    public static BusinessException of(IErrorInfo errorInfo, Throwable cause) {
        return new BusinessException(errorInfo, cause);
    }

    public static BusinessException of(IErrorInfo errorInfo, Object... args) {
        return new BusinessException(errorInfo, args);
    }

    public static BusinessException of(IErrorInfo errorInfo, Throwable cause, Object... args) {
        return new BusinessException(errorInfo, cause, args);
    }
}
